package com.sunsy.authserver.wrapper;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sunsy.authserver.beans.dto.UniformUserDTO;
import com.sunsy.authserver.beans.po.UniformUser;
import com.sunsy.authserver.beans.vo.UniformUserVO;

/**
 * (UniformUser)表包装类
 *
 * @author makejava
 * @since 2021-07-20 14:40:40
 */
public class UniformUserWrapper extends AbstractWrapper<UniformUser, UniformUserVO, UniformUserDTO>{

  public static UniformUserWrapper build() {
    return new UniformUserWrapper();
  }

  /**
   * dto转queryWrapper
   *
   * @param dto 交互数据
   * @return 查询Wrapper
   */
  @Override
  public QueryWrapper<UniformUser> dto2QWrapper(UniformUserDTO dto) {
    UniformUser po = dto2PO(dto);
    return new QueryWrapper<>(po);
  }

  /**
   * dto转po
   *
   * @param dto 交互数据
   * @return UniformUser 实体对象
   */
  @Override
  public UniformUser dto2PO(UniformUserDTO dto) {
    return BeanUtil.copyProperties(dto, UniformUser.class);
  }

  /**
   * po转vo
   *
   * @param po 实体对象
   * @return UniformUser 实体展示对象
   */
  @Override
  public UniformUserVO po2VO(UniformUser po) {
    return BeanUtil.copyProperties(po, UniformUserVO.class);
  }

}